#ifndef __MAIN_H
#define __MAIN_H

#include <stdint.h>
#include "tremo_regs.h"
#include "tremo_gpio.h"

#define LED_GPIOX                        GPIOA
#define LED_PIN                          GPIO_PIN_8
#define LOG_UART_SEL                     UART0
#define LOG_UART_CLK                     RCC_PERIPHERAL_UART0
#define LOG_UART_BAUDRATE                UART_BAUDRATE_115200
#define LOG_UART_TX_GPIO                 GPIOB
#define LOG_UART_TX_PIN                  GPIO_PIN_0
#define LOG_UART_TX_AFUN                 1
#define LOG_UART_RX_GPIO                 GPIOB
#define LOG_UART_RX_PIN                  GPIO_PIN_1
#define LOG_UART_RX_AFUN                 1
#define PULSE_IA_RCC_CLK                 RCC_PERIPHERAL_GPIOD
#define PULSE_IB_RCC_CLK                 RCC_PERIPHERAL_GPIOD
#define PULSE_INPUT_MODE                 GPIO_MODE_INPUT_PULL_DOWN
#define PULSE_IA_GPIO                    GPIOD
#define PULSE_IA_PIN                     GPIO_PIN_12
#define PULSE_IA_AFUN                    4
#define PULSE_IB_GPIO                    GPIOD
#define PULSE_IB_PIN                     GPIO_PIN_14
#define PULSE_IB_AFUN                    4
#define PULSE_COUNT_LPTIMER_SEL          LPTIMER1
#define PULSE_COUNT_LPTIMER_CLK          RCC_PERIPHERAL_LPTIMER1
#define PULSE_COUNT_LPTIMER_CLK_SET_FUNC rcc_set_lptimer1_clk_source
#define PULSE_COUNT_LPTIMER_CLK_SOURCE   RCC_LPTIMER1_CLK_SOURCE_XO32K
#define PULSE_COUNT_LPTIMER_PRESCALER    LPTIMER_PRESC_1
#define PULSE_COUNT_LPTIMER_ARR_VAL      (8 - 1)
#define PULSE_COUNT_LPTIMER_CKPOL        LPTIMER_CKPOL_RISING
#define PULSE_COUNT_LPTIMER_IRQ          LPTIMER1_IRQn
#define PULSE_COUNT_LPTIMER_IRQ_PRIORITY 2
#define PULSE_COUNT_LPTIMER_IRQHandler   LPTIMER1_IRQHandler

#define KEY_GPIOX GPIOA
#define KEY_PIN   GPIO_PIN_11

extern volatile uint32_t g_gpio_interrupt_flag;


#endif /* __MAIN_H */